//md5 b443c33e07d625cff0a84139ef9e6969
(function() {
  var _, _expr, _importLib, add, addr_decode, all0, all1, bin, cat, chdl_base, complex_add, complex_mul, dec, expand, has0, has1, hasEven1, hasOdd1, hex, infer, mult, oct;

  chdl_base = require('chdl_base');

  ({_expr} = require('chdl_utils'));

  ({cat, expand, all1, all0, has0, has1, hasOdd1, hasEven1} = require('chdl_operator'));

  ({infer, hex, oct, bin, dec} = require('chdl_base'));

  ({_importLib} = require('chdl_transpiler_engine'));

  module.paths.push('/home/lisiyu/work/project/fft/src');

  _ = require("lodash");

  add = function(word_a, word_b, en, config) {
    var MantScale, all_zero, expn_10r, expn_aln, expn_dif, expn_sft, group, i, index, j, lead_zeros, len, mant_10, mant_10_abs, mant_padded, norms, result, s_reg, shift_num, sum_expn, sum_mant, sum_sign;
    result = this._localWire(32, "result");
    this._assign(result, '4');
    MantScale = this.numWidth(config.factor_width + 3);
    s_reg = this._localReg(config.exp_width + config.factor_width + 4, 's_reg');
    group = [
      {
        sign: this._localWire(1,
      'sign'),
        expn: this._localWire(config.exp_width,
      'expn'),
        expn_d: this._localWire(config.exp_width,
      'expn_d'),
        mant: this._localWire(config.factor_width + 1,
      'mant'),
        num: word_a,
        mant_sft: this._localWire(config.factor_width + 4,
      'mant_sft'),
        mant_sgn: this._localWire(config.factor_width + 4,
      'mant_sgn')
      },
      {
        sign: this._localWire(1,
      'sign'),
        expn: this._localWire(config.exp_width,
      'expn'),
        expn_d: this._localWire(config.exp_width,
      'expn_d'),
        mant: this._localWire(config.factor_width + 1,
      'mant'),
        num: word_b,
        mant_sft: this._localWire(config.factor_width + 4,
      'mant_sft'),
        mant_sgn: this._localWire(config.factor_width + 4,
      'mant_sgn')
      }
    ];
    norms = this._localWire(2, "norms");
    this._assign(norms, '28');
    expn_aln = this._localWire(config.exp_width, "expn_aln");
    this._assign(expn_aln, '29');
    for (index = j = 0, len = group.length; j < len; index = ++j) {
      i = group[index];
      this._assign(norms(index), '32')(() => {
        return _expr(chdl_base.Expr.start().next(has1(i.expn)), '32');
      });
      this._assign(i.sign, '33')(() => {
        return _expr(chdl_base.Expr.start().next(i.num(config.sign_bit)), '33');
      });
      this._assign(i.expn, '34')(() => {
        return _expr(chdl_base.Expr.start().next(i.num(config.exp_slice)), '34');
      });
      this._assign(i.mant.fromLsb(config.factor_width), '35')(() => {
        return _expr(chdl_base.Expr.start().next(i.num(config.factor_slice)), '35');
      });
      this._assign(i.mant.fromMsb(1), '36')(() => {
        return _expr(chdl_base.Expr.start().next(norms(index)), '36');
      });
      this._assign(i.expn_d, '37')(() => {
        return _expr(chdl_base.Expr.start().next(i.expn).next("+").next("!").next(norms(index)), '37');
      });
      shift_num = this._localWire(config.exp_width, "shift_num");
      this._assign(shift_num, '38')(() => {
        return _expr(chdl_base.Expr.start().next(expn_aln).next("-").next(i.expn_d), '38');
      });
      this._assign(i.mant_sft, '39')(() => {
        var list;
        list = _.map(_.range(config.factor_width + 1), (n) => {
          return this._cond(chdl_base.Expr.start().next(n).next("==").next(shift_num), '41')(() => {
            return _expr(chdl_base.Expr.start().next(i.mant).next(">>>").next(n), '41');
          });
        });
        return this._if(chdl_base.Expr.start().next(shift_num).next("<").next(config.factor_width).next("+").next(dec(1)), '43')(() => {
          return this._balance(list, config.factor_width + 4);
        })._else('45')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '46');
        })._endif();
      });
      this._assign(i.mant_sgn, '47')(() => {
        return this._if(chdl_base.Expr.start().next(i.sign), '48')(() => {
          return _expr(chdl_base.Expr.start().next("~").next(i.mant_sft), '48');
        })._else('49')(() => {
          return _expr(chdl_base.Expr.start().next(i.mant_sft), '49');
        })._endif();
      });
    }
    this._assign(s_reg.fromMsb(config.exp_width), '51')(() => {
      return this._if(chdl_base.Expr.start().next(en), '52')(() => {
        return _expr(chdl_base.Expr.start().next(expn_aln), '53');
      })._else('54')(() => {
        return _expr(chdl_base.Expr.start().next(s_reg.fromMsb(config.exp_width)), '55');
      })._endif();
    });
    this._assign(s_reg.fromLsb(config.factor_width + 4), '57')(() => {
      return this._if(chdl_base.Expr.start().next(en), '58')(() => {
        return _expr(chdl_base.Expr.start().next(group[0].mant_sgn).next("+").next(group[1].mant_sgn).next("+").next(group[0].sign).next("+").next(group[1].sign), '59');
      })._else('60')(() => {
        return _expr(chdl_base.Expr.start().next(s_reg.fromLsb(config.factor_width + 4)), '61');
      })._endif();
    });
    expn_dif = this._localWire(config.exp_width + 1, "expn_dif");
    this._assign(expn_dif, '63')(() => {
      return _expr(chdl_base.Expr.start().next(group[1].expn_d).next("-").next(group[0].expn_d), '63');
    });
    this._assign(expn_aln, '64')(() => {
      return this._if(chdl_base.Expr.start().next(expn_dif.fromMsb(1)), '65')(() => {
        return _expr(chdl_base.Expr.start().next(group[0].expn_d), '66');
      })._else('67')(() => {
        return _expr(chdl_base.Expr.start().next(group[1].expn_d), '68');
      })._endif();
    });
    expn_10r = this._localWire(config.exp_width, "expn_10r");
    this._assign(expn_10r, '70')(() => {
      return _expr(chdl_base.Expr.start().next(s_reg.fromMsb(config.exp_width)), '70');
    });
    mant_10 = this._localWire(config.factor_width + 4, "mant_10");
    this._assign(mant_10, '71')(() => {
      return _expr(chdl_base.Expr.start().next(s_reg.fromLsb(config.factor_width + 4)), '71');
    });
    mant_10_abs = this._localWire(config.factor_width + 3, "mant_10_abs");
    this._assign(mant_10_abs, '73')(() => {
      return this._if(chdl_base.Expr.start().next(mant_10.fromMsb(1)), '74')(() => {
        return _expr(chdl_base.Expr.start().next("~").next(mant_10), '74');
      })._else('75')(() => {
        return _expr(chdl_base.Expr.start().next(mant_10), '75');
      })._endif();
    });
    mant_padded = this._localWire(config.factor_width * 2 + 3, "mant_padded");
    this._assign(mant_padded, '77')(() => {
      return _expr(chdl_base.Expr.start().next(cat(mant_10_abs, bin(config.factor_width, 0))), '77');
    });
    lead_zeros = this._localWire(MantScale, "lead_zeros");
    this._assign(lead_zeros, '79');
    all_zero = this._localWire(1, "all_zero");
    this._assign(all_zero, '80');
    this._assign(all_zero, '82')(() => {
      return _expr(chdl_base.Expr.start().next("!").next(mant_10_abs), '82');
    });
    this._assign(lead_zeros, '84')(() => {
      var k, len1, list, ref;
      list = [];
      ref = _.range(26);
      for (k = 0, len1 = ref.length; k < len1; k++) {
        i = ref[k];
        list.push(this._cond(chdl_base.Expr.start().next(mant_10_abs(25 - i)), '87')(() => {
          return _expr(chdl_base.Expr.start().next(i), '87');
        }));
      }
      list.push(this._cond(null, '89')(() => {
        return _expr(chdl_base.Expr.start().next(dec(0)), '89');
      }));
      return this._order(list);
    });
    expn_sft = this._localWire(config.exp_width + 2, "expn_sft");
    this._assign(expn_sft, '93')(() => {
      return _expr(chdl_base.Expr.start().next(expn_10r).next("+").next(dec(2)).next("-").next(lead_zeros), '93');
    });
    sum_sign = this._localWire(1, "sum_sign");
    this._assign(sum_sign, '94')(() => {
      return _expr(chdl_base.Expr.start().next(mant_10.fromMsb(1)), '94');
    });
    sum_expn = this._localWire(config.exp_width, "sum_expn");
    this._assign(sum_expn, '95')(() => {
      return this._if(chdl_base.Expr.start().next(all_zero).next("||").next(expn_sft.fromMsb(1)), '96')(() => {
        return _expr(chdl_base.Expr.start().next(dec(0)), '96');
      })._elseif(chdl_base.Expr.start().next(expn_sft(config.exp_width)), '97')(() => {
        return _expr(chdl_base.Expr.start().next(expand(config.exp_width, bin(1, "0b1"))), '97');
      })._else('98')(() => {
        return _expr(chdl_base.Expr.start().next(expn_sft.fromLsb(config.exp_width)), '98');
      })._endif();
    });
    sum_mant = this._localWire(config.factor_width, "sum_mant");
    this._assign(sum_mant, '100')(() => {
      return this._if(chdl_base.Expr.start().next(all_zero), '101')(() => {
        return _expr(chdl_base.Expr.start().next(dec(0)), '101');
      })._else('102')(() => {
        var k, len1, list, ref;
        list = [];
        ref = _.range(config.factor_width + 3);
        for (k = 0, len1 = ref.length; k < len1; k++) {
          i = ref[k];
          list.push(this._cond(chdl_base.Expr.start().next(i).next("==").next(lead_zeros), '105')(() => {
            return _expr(chdl_base.Expr.start().next(mant_padded(config.factor_width + 2 - i, config.factor_width)), '105');
          }));
        }
        return this._balance(list);
      })._endif();
    });
    this._assign(result(config.sign_bit), '108')(() => {
      return _expr(chdl_base.Expr.start().next(sum_sign), '108');
    });
    this._assign(result(config.exp_slice), '109')(() => {
      return _expr(chdl_base.Expr.start().next(sum_expn), '109');
    });
    this._assign(result(config.factor_slice), '110')(() => {
      return _expr(chdl_base.Expr.start().next(sum_mant), '110');
    });
    return _expr(chdl_base.Expr.start().next(result), '111');
  };

  mult = function(word_a, word_b, en, overflow, config) {
    var bias, exp_add1, result, result_exp, result_factor, result_sign, valid_factor_norm, valid_factor_shift;
    bias = 2 ** (config.exp_width - 1) - 1;
    result_sign = this._localWire(1, "result_sign");
    this._assign(result_sign, '117')(() => {
      return _expr(chdl_base.Expr.start().next(word_a(config.sign_bit)).next("^").next(word_b(config.sign_bit)), '117');
    });
    result_exp = this._localWire(config.exp_width + 1, "result_exp");
    this._assign(result_exp, '118')(() => {
      return _expr(chdl_base.Expr.start().next(word_a(config.exp_slice)).next("-").next(bias).next("+").next("(").next(word_b(config.exp_slice)).next(")"), '118');
    });
    exp_add1 = this._localWire(config.exp_width + 1, "exp_add1");
    this._assign(exp_add1, '119')(() => {
      return _expr(chdl_base.Expr.start().next(result_exp).next("+").next(dec(1)), '119');
    });
    this._assign(overflow, '121')(() => {
      return _expr(chdl_base.Expr.start().next(result_exp.fromMsb(1)).next("||").next(exp_add1.fromMsb(1)), '121');
    });
    result_factor = this._localWire((config.factor_width + 1) * 2, "result_factor");
    this._assign(result_factor, '122');
    this._assign(result_factor, '123')(() => {
      return _expr(chdl_base.Expr.start().next(cat(bin(1, "0b1"), word_a(config.factor_slice))).next("*").next(cat(bin(1, "0b1"), word_b(config.factor_slice))), '123');
    });
    valid_factor_norm = this._localWire(config.factor_width, "valid_factor_norm");
    this._assign(valid_factor_norm, '133')(() => {
      return _expr(chdl_base.Expr.start().next(result_factor.fromMsb(2 + config.factor_width).fromLsb(config.factor_width)), '133');
    });
    valid_factor_shift = this._localWire(config.factor_width, "valid_factor_shift");
    this._assign(valid_factor_shift, '134')(() => {
      return _expr(chdl_base.Expr.start().next(result_factor.fromMsb(1 + config.factor_width).fromLsb(config.factor_width)), '134');
    });
    //Net(result,32)sum
    result = this._localReg(config.width, "mult_result");
    this._always('138', () => {
      return this._if(chdl_base.Expr.start().next(result_factor.fromMsb(2)).next("==").next(bin(2, "0b01")).next("&&").next(en), '139')(() => {
        return this._assign(result, '140')(() => {
          return _expr(chdl_base.Expr.start().next(cat(result_sign, result_exp.fromLsb(config.exp_width), valid_factor_norm)), '140');
        });
      })._elseif(chdl_base.Expr.start().next(result_factor.fromMsb(1)).next("==").next(bin(1, "0b1")).next("&&").next(en), '141')(() => {
        return this._assign(result, '142')(() => {
          return _expr(chdl_base.Expr.start().next(cat(result_sign, exp_add1.fromLsb(config.exp_width), valid_factor_shift)), '142');
        });
      })._endif();
    });
    return _expr(chdl_base.Expr.start().next(result), '143');
  };

  complex_add = function(a_1, a_2, en_1, en_2, config) { // two cycle
    var a_1_imag, a_1_real, a_2_imag, a_2_real, data_width, half_width, sum, sum_imag, sum_real;
    data_width = a_1.getWidth();
    half_width = data_width / 2;
    a_1_real = this._localWire(half_width, "a_1_real");
    this._assign(a_1_real, '152');
    a_1_imag = this._localWire(half_width, "a_1_imag");
    this._assign(a_1_imag, '153');
    a_2_real = this._localWire(half_width, "a_2_real");
    this._assign(a_2_real, '155');
    a_2_imag = this._localWire(half_width, "a_2_imag");
    this._assign(a_2_imag, '156');
    sum_real = this._localWire(half_width, "sum_real");
    this._assign(sum_real, '158');
    sum_imag = this._localWire(half_width, "sum_imag");
    this._assign(sum_imag, '159');
    sum = this._localReg(data_width, "complex_sum");
    this._assign(a_1_real, '163')(() => {
      return _expr(chdl_base.Expr.start().next(a_1.fromMsb(half_width)), '163');
    });
    this._assign(a_1_imag, '164')(() => {
      return _expr(chdl_base.Expr.start().next(a_1.fromLsb(half_width)), '164');
    });
    this._assign(a_2_real, '166')(() => {
      return _expr(chdl_base.Expr.start().next(a_2.fromMsb(half_width)), '166');
    });
    this._assign(a_2_imag, '167')(() => {
      return _expr(chdl_base.Expr.start().next(a_2.fromLsb(half_width)), '167');
    });
    this._assign(sum_real, '171')(() => {
      return _expr(chdl_base.Expr.start().next(add.call(this, a_1_real, a_2_real, en_1, config)), '171');
    });
    this._assign(sum_imag, '172')(() => {
      return _expr(chdl_base.Expr.start().next(add.call(this, a_1_imag, a_2_imag, en_1, config)), '172');
    });
    this._assign(sum, '174')(() => {
      return this._if(chdl_base.Expr.start().next(en_2), '175')(() => {
        return _expr(chdl_base.Expr.start().next(cat(sum_real, sum_imag)), '176');
      })._else('177')(() => {
        return _expr(chdl_base.Expr.start().next(sum), '178');
      })._endif();
    });
    return _expr(chdl_base.Expr.start().next(sum), '180');
  };

  complex_mul = function(m_1, m_2, en_1, en_2, en_3, config) { // three cycle
    var data_width, half_width, imag_x_imag, imag_x_real, m_1_imag, m_1_real, m_2_imag, m_2_real, neg_imag_x_imag, overflow_1, overflow_2, overflow_3, overflow_4, prod, prod_imag, prod_real, real_x_imag, real_x_real;
    data_width = m_1.getWidth();
    half_width = data_width / 2;
    m_1_real = this._localWire(half_width, "m_1_real");
    this._assign(m_1_real, '187');
    m_2_real = this._localWire(half_width, "m_2_real");
    this._assign(m_2_real, '188');
    m_1_imag = this._localWire(half_width, "m_1_imag");
    this._assign(m_1_imag, '190');
    m_2_imag = this._localWire(half_width, "m_2_imag");
    this._assign(m_2_imag, '191');
    prod_real = this._localWire(half_width, "prod_real");
    this._assign(prod_real, '193');
    prod_imag = this._localWire(half_width, "prod_imag");
    this._assign(prod_imag, '194');
    real_x_real = this._localWire(half_width, "real_x_real");
    real_x_imag = this._localWire(half_width, "real_x_imag");
    imag_x_real = this._localWire(half_width, "imag_x_real");
    imag_x_imag = this._localWire(half_width, "imag_x_imag");
    prod = this._localReg(data_width, "complex_prod");
    overflow_1 = this._localWire(1, "overflow_1");
    this._assign(overflow_1, '203');
    overflow_2 = this._localWire(1, "overflow_2");
    this._assign(overflow_2, '204');
    overflow_3 = this._localWire(1, "overflow_3");
    this._assign(overflow_3, '205');
    overflow_4 = this._localWire(1, "overflow_4");
    this._assign(overflow_4, '206');
    this._assign(real_x_real, '208')(() => {
      return _expr(chdl_base.Expr.start().next(mult.call(this, m_1_real, m_2_real, en_1, overflow_1, config)), '208');
    });
    this._assign(real_x_imag, '209')(() => {
      return _expr(chdl_base.Expr.start().next(mult.call(this, m_1_real, m_2_imag, en_1, overflow_2, config)), '209');
    });
    this._assign(imag_x_real, '210')(() => {
      return _expr(chdl_base.Expr.start().next(mult.call(this, m_1_imag, m_2_real, en_1, overflow_3, config)), '210');
    });
    this._assign(imag_x_imag, '211')(() => {
      return _expr(chdl_base.Expr.start().next(mult.call(this, m_1_imag, m_2_imag, en_1, overflow_4, config)), '211');
    });
    neg_imag_x_imag = this._localWire(half_width, "neg_imag_x_imag");
    this._assign(neg_imag_x_imag, '213')(() => {
      return _expr(chdl_base.Expr.start().next(cat(bin(1, 1), imag_x_imag.fromLsb(half_width - 1))), '213');
    });
    this._assign(prod_real, '215')(() => {
      return _expr(chdl_base.Expr.start().next(add.call(this, real_x_real, neg_imag_x_imag, en_2, config)), '215');
    });
    this._assign(prod_imag, '216')(() => {
      return _expr(chdl_base.Expr.start().next(add.call(this, real_x_imag, imag_x_real, en_2, config)), '216');
    });
    this._assign(prod, '218')(() => {
      return this._if(chdl_base.Expr.start().next(en_3), '219')(() => {
        return _expr(chdl_base.Expr.start().next(cat(prod_real, prod_imag)), '220');
      })._else('221')(() => {
        return _expr(chdl_base.Expr.start().next(prod), '222');
      })._endif();
    });
    return _expr(chdl_base.Expr.start().next(prod), '225');
  };

  addr_decode = function(addr_in, mem_cfg) {
    var addr_out, addr_width, end_addr, start_addr;
    addr_width = addr_in.getWidth();
    start_addr = mem_cfg.depth * mem_cfg.idx;
    end_addr = start_addr + mem_cfg.depth;
    addr_out = this._localWire(addr_width, "addr_out");
    this._assign(addr_out, '234');
    this._assign(addr_out, '236')(() => {
      return this._if(chdl_base.Expr.start().next(addr_in).next(">=").next(start_addr).next("&&").next(addr_in).next("<").next(end_addr), '237')(() => {
        return _expr(chdl_base.Expr.start().next(addr_in).next("-").next(start_addr), '238');
      })._else('239')(() => {
        return _expr(chdl_base.Expr.start().next(end_addr), '240');
      })._endif();
    });
    return _expr(chdl_base.Expr.start().next(addr_out), '242');
  };

  module.exports = {
    $add: add,
    $mult: mult,
    $complex_add: complex_add,
    $complex_mul: complex_mul,
    $addr_decode: addr_decode,
    $ctrl_pip: function(valid, grant, even_addr, odd_addr, cal_step = 5) {
      var addr_width, ctrl, ctrl_list, i, j, len, ref;
      ctrl_list = [];
      addr_width = even_addr.getWidth();
      ctrl = this.createArray(cal_step, () => {
        return {
          valid: this._localReg(1, "ctrl_valid"),
          even_addr: this._localReg(addr_width, "ctrl_even_addr"),
          odd_addr: this._localReg(addr_width, "ctrl_odd_addr"),
          en: this._localReg(1, "ctrl_en")
        };
      });
      ref = _.range(cal_step);
      for (j = 0, len = ref.length; j < len; j++) {
        i = ref[j];
        if (i === 0) {
          this._assign(ctrl[i].even_addr, '270')(() => {
            return this._if(chdl_base.Expr.start().next(valid).next("&&").next(grant), '271')(() => {
              return _expr(chdl_base.Expr.start().next(even_addr), '272');
            })._else('273')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].even_addr), '274');
            })._endif();
          });
          this._assign(ctrl[i].odd_addr, '276')(() => {
            return this._if(chdl_base.Expr.start().next(valid).next("&&").next(grant), '277')(() => {
              return _expr(chdl_base.Expr.start().next(odd_addr), '278');
            })._else('279')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].even_addr), '280');
            })._endif();
          });
          this._assign(ctrl[i].valid, '282')(() => {
            return this._if(chdl_base.Expr.start().next(grant), '283')(() => {
              return _expr(chdl_base.Expr.start().next(valid), '284');
            })._else('285')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].valid), '286');
            })._endif();
          });
          this._assign(ctrl[i].en, '288')(() => {
            return _expr(chdl_base.Expr.start().next(valid).next("&&").next(grant), '288');
          });
        } else {
          this._assign(ctrl[i].valid, '290')(() => {
            return this._if(chdl_base.Expr.start().next(grant), '291')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i - 1].valid), '292');
            })._else('293')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].valid), '294');
            })._endif();
          });
          this._assign(ctrl[i].even_addr, '296')(() => {
            return this._if(chdl_base.Expr.start().next(ctrl[i - 1].valid).next("&&").next(grant), '297')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i - 1].even_addr), '298');
            })._else('299')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].even_addr), '300');
            })._endif();
          });
          this._assign(ctrl[i].odd_addr, '302')(() => {
            return this._if(chdl_base.Expr.start().next(ctrl[i - 1].valid).next("&&").next(grant), '303')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i - 1].odd_addr), '304');
            })._else('305')(() => {
              return _expr(chdl_base.Expr.start().next(ctrl[i].odd_addr), '306');
            })._endif();
          });
          this._assign(ctrl[i].en, '308')(() => {
            return _expr(chdl_base.Expr.start().next(ctrl[i - 1].valid).next("&").next(grant), '308');
          });
        }
      }
      return ctrl;
    },
    $mem_if: function(rd_signal, wr_signal, grant) { // en is a list
      var addr_width, data_width, en, rd_addr_buf, rd_data_buf, rd_even_data_ready, rd_even_valid, rd_odd_data_ready, rd_odd_valid, rd_ready, rd_running, sram, wr_add_data_ready, wr_add_valid, wr_addr_buf, wr_data_buf, wr_ready, wr_running, wr_sub_data_ready, wr_sub_valid;
      addr_width = rd_signal.even_addr.getWidth();
      data_width = rd_signal.even_data.getWidth();
      en = this.createArray(4, () => {
        return this._localWire(1, "pip_en");
      });
      sram = {
        valid: this._localWire(1, "sram_valid"),
        ready: this._localWire(1, "sram_ready"),
        we_n: this._localWire(1, "we_n"),
        addr: this._localWire(addr_width, "waddr"),
        wdata: this._localWire(data_width, "wdata"),
        rdata: this._localWire(data_width, "rdata")
      };
      rd_running = this._localReg(1, "memif_rd_running");
      wr_running = this._localReg(1, "memif_wr_running");
      rd_data_buf = this._localReg(data_width, "memif_rd_data_buf");
      rd_addr_buf = this._localReg(data_width, "memif_rd_addr_buf");
      wr_data_buf = this._localReg(data_width, "memif_wr_data_buf");
      wr_addr_buf = this._localReg(data_width, "memif_wr_addr_buf");
      rd_ready = this._localReg(1, "memif_rd_ready");
      wr_ready = this._localReg(1, "memif_wr_ready");
      rd_even_valid = this._localReg(1, "memif_rd_even_valid");
      rd_odd_valid = this._localReg(1, "memif_rd_odd_valid");
      wr_add_valid = this._localReg(1, "memif_wr_t_valid");
      wr_sub_valid = this._localReg(1, "memif_wr_e_valid");
      rd_even_data_ready = this._localWire(1, "rd_even_data_ready");
      this._assign(rd_even_data_ready, '348');
      rd_odd_data_ready = this._localWire(1, "rd_odd_data_ready");
      this._assign(rd_odd_data_ready, '349');
      wr_add_data_ready = this._localWire(1, "wr_add_data_ready");
      this._assign(wr_add_data_ready, '351');
      wr_sub_data_ready = this._localWire(1, "wr_sub_data_ready");
      this._assign(wr_sub_data_ready, '352');
      this._assign(rd_running, '354')(() => {
        return this._if(chdl_base.Expr.start().next(rd_odd_data_ready).next("&&").next(rd_running), '355')(() => {
          return _expr(chdl_base.Expr.start().next(rd_signal.valid), '356');
        })._elseif(chdl_base.Expr.start().next(rd_signal.valid), '357')(() => {
          return _expr(chdl_base.Expr.start().next(dec(1)), '358');
        })._else('359')(() => {
          return _expr(chdl_base.Expr.start().next(rd_running), '360');
        })._endif();
      });
      this._assign(wr_running, '362')(() => {
        return this._if(chdl_base.Expr.start().next(wr_sub_data_ready).next("&&").next(wr_running), '363')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.valid), '364');
        })._elseif(chdl_base.Expr.start().next(wr_signal.valid), '365')(() => {
          return _expr(chdl_base.Expr.start().next(dec(1)), '366');
        })._else('367')(() => {
          return _expr(chdl_base.Expr.start().next(wr_running), '368');
        })._endif();
      });
      this._assign(rd_data_buf, '371')(() => {
        return this._if(chdl_base.Expr.start().next(rd_odd_valid), '372')(() => {
          return _expr(chdl_base.Expr.start().next(sram.rdata), '373');
        })._else('374')(() => {
          return _expr(chdl_base.Expr.start().next(rd_data_buf), '375');
        })._endif();
      });
      this._assign(rd_addr_buf, '377')(() => {
        return this._if(chdl_base.Expr.start().next(rd_signal.valid).next("&&").next(en[0]), '378')(() => {
          return _expr(chdl_base.Expr.start().next(rd_signal.odd_addr), '379');
        })._else('380')(() => {
          return _expr(chdl_base.Expr.start().next(rd_addr_buf), '381');
        })._endif();
      });
      this._assign(rd_even_valid, '383')(() => {
        return this._if(chdl_base.Expr.start().next(en[0]).next("&&").next("(").next("!").next(wr_add_valid).next(")").next("&&").next("(").next("!").next(wr_sub_valid).next(")"), '384')(() => {
          return _expr(chdl_base.Expr.start().next(rd_signal.valid), '385');
        })._else('386')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '387');
        })._endif();
      });
      this._assign(rd_odd_valid, '389')(() => {
        return this._if(chdl_base.Expr.start().next(en[1]).next("&&").next(rd_odd_data_ready), '390')(() => {
          return _expr(chdl_base.Expr.start().next(rd_even_data_ready), '391');
        })._elseif(chdl_base.Expr.start().next(en[1]).next("&&").next(rd_even_data_ready), '392')(() => {
          return _expr(chdl_base.Expr.start().next(dec(1)), '393');
        })._else('394')(() => {
          return _expr(chdl_base.Expr.start().next(rd_odd_valid), '395');
        })._endif();
      });
      this._assign(wr_data_buf, '398')(() => {
        return this._if(chdl_base.Expr.start().next(wr_signal.valid).next("&&").next(en[3]), '399')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.sub_data), '400');
        })._else('401')(() => {
          return _expr(chdl_base.Expr.start().next(wr_data_buf), '402');
        })._endif();
      });
      this._assign(wr_addr_buf, '404')(() => {
        return this._if(chdl_base.Expr.start().next(wr_signal.valid).next("&&").next(en[3]), '405')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.odd_addr), '406');
        })._else('407')(() => {
          return _expr(chdl_base.Expr.start().next(wr_addr_buf), '408');
        })._endif();
      });
      this._assign(wr_add_valid, '410')(() => {
        return this._if(chdl_base.Expr.start().next(en[3]), '411')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.valid), '412');
        })._else('413')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '414');
        })._endif();
      });
      this._assign(wr_sub_valid, '416')(() => {
        return this._if(chdl_base.Expr.start().next(wr_sub_data_ready), '417')(() => {
          return _expr(chdl_base.Expr.start().next(wr_add_data_ready), '418');
        })._elseif(chdl_base.Expr.start().next(wr_add_data_ready), '419')(() => {
          return _expr(chdl_base.Expr.start().next(dec(1)), '420');
        })._else('421')(() => {
          return _expr(chdl_base.Expr.start().next(wr_sub_valid), '422');
        })._endif();
      });
      this._assign(rd_even_data_ready, '424')(() => {
        return _expr(chdl_base.Expr.start().next(rd_running).next("&&").next(rd_even_valid).next("&&").next(sram.ready).next("&&").next("(").next("!").next(wr_add_valid).next(")").next("&&").next("(").next("!").next(wr_sub_valid).next(")"), '424');
      });
      this._assign(rd_odd_data_ready, '425')(() => {
        return _expr(chdl_base.Expr.start().next(rd_running).next("&&").next(rd_odd_valid).next("&&").next(sram.ready).next("&&").next("(").next("!").next(wr_add_valid).next(")").next("&&").next("(").next("!").next(wr_sub_valid).next(")"), '425');
      });
      this._assign(wr_add_data_ready, '427')(() => {
        return _expr(chdl_base.Expr.start().next(wr_running).next("&&").next(wr_add_valid).next("&&").next(sram.ready), '427');
      });
      this._assign(wr_sub_data_ready, '428')(() => {
        return _expr(chdl_base.Expr.start().next(wr_running).next("&&").next(wr_sub_valid).next("&&").next(sram.ready), '428');
      });
      this._assign(sram.valid, '430')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(rd_even_valid).next("||").next(rd_odd_valid).next("&&").next("(").next("!").next(wr_add_valid).next(")").next("&&").next("(").next("!").next(wr_sub_valid).next(")").next("||").next(wr_add_valid).next("||").next(wr_sub_valid).next(")"), '430');
      });
      this._assign(sram.we_n, '431')(() => {
        return _expr(chdl_base.Expr.start().next("!").next("(").next(wr_add_valid).next("||").next(wr_sub_valid).next(")"), '431');
      });
      this._assign(sram.addr, '433')(() => {
        return this._if(chdl_base.Expr.start().next(wr_add_valid), '434')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.even_addr), '435');
        })._elseif(chdl_base.Expr.start().next(wr_sub_valid), '436')(() => {
          return _expr(chdl_base.Expr.start().next(wr_addr_buf), '437');
        })._elseif(chdl_base.Expr.start().next(rd_even_valid), '438')(() => {
          return _expr(chdl_base.Expr.start().next(rd_signal.even_addr), '439');
        })._elseif(chdl_base.Expr.start().next(rd_odd_valid), '440')(() => {
          return _expr(chdl_base.Expr.start().next(rd_addr_buf), '441');
        })._else('442')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '443');
        })._endif();
      });
      this._assign(sram.wdata, '445')(() => {
        return this._if(chdl_base.Expr.start().next(wr_add_valid), '446')(() => {
          return _expr(chdl_base.Expr.start().next(wr_signal.add_data), '447');
        })._elseif(chdl_base.Expr.start().next(wr_sub_valid), '448')(() => {
          return _expr(chdl_base.Expr.start().next(wr_data_buf), '449'); // reg
        })._else('450')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '451');
        })._endif();
      });
      this._assign(rd_signal.even_data, '453')(() => { // reg
        return this._if(chdl_base.Expr.start().next(rd_ready), '454')(() => {
          return _expr(chdl_base.Expr.start().next(rd_data_buf), '455');
        })._else('456')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '457');
        })._endif();
      });
      this._assign(rd_signal.odd_data, '459')(() => {
        return this._if(chdl_base.Expr.start().next(rd_ready), '460')(() => {
          return _expr(chdl_base.Expr.start().next(sram.rdata), '461');
        })._else('462')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '463');
        })._endif();
      });
      this._assign(en[0], '465')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(rd_odd_valid).next("&&").next(rd_odd_data_ready).next("||").next("!").next(rd_odd_valid).next(")"), '465');
      });
      this._assign(en[1], '466')(() => {
        return _expr(chdl_base.Expr.start().next(grant), '466');
      });
      this._assign(en[2], '467')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(wr_add_valid).next("&&").next(wr_add_data_ready).next("||").next("!").next(wr_add_valid).next(")"), '467');
      });
      this._assign(en[3], '468')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(wr_sub_valid).next("&&").next(wr_sub_data_ready).next("||").next("!").next(wr_sub_valid).next(")"), '468');
      });
      this._assign(rd_ready, '470')(() => {
        return _expr(chdl_base.Expr.start().next(rd_odd_data_ready), '470');
      });
      this._assign(wr_ready, '471')(() => {
        return _expr(chdl_base.Expr.start().next(wr_sub_data_ready), '471');
      });
      this._assign(rd_signal.ready, '473')(() => {
        return _expr(chdl_base.Expr.start().next(rd_ready), '473');
      });
      this._assign(rd_signal.grant, '474')(() => {
        return _expr(chdl_base.Expr.start().next(rd_even_valid).next("&&").next(rd_even_data_ready).next("||").next("!").next(rd_even_valid), '474');
      });
      this._assign(wr_signal.ready, '476')(() => {
        return _expr(chdl_base.Expr.start().next(wr_ready), '476');
      });
      this._assign(wr_signal.grant, '477')(() => {
        return _expr(chdl_base.Expr.start().next(en[2]), '477');
      });
      return sram;
    },
    $fft_cell: function(exp, even_addr_data, odd_addr_data, en, config) { // en i:s signal list
      var cal_step, data_width, e, even_addr_data_dly, even_addr_data_dly_2, even_addr_data_dly_3, exp_dly, exp_dly_2, exp_dly_3, neg_e, res, t;
      data_width = even_addr_data.getWidth();
      cal_step = 5;
      config = {
        sign_bit: 31,
        exp_slice: {
          30: 23
        },
        exp_width: 8,
        factor_slice: {
          22: 0
        },
        factor_width: 23,
        width: 32
      };
      even_addr_data_dly = this._localReg(data_width, "exp_dly");
      even_addr_data_dly_2 = this._localReg(data_width, "exp_dly_2");
      even_addr_data_dly_3 = this._localReg(data_width, "exp_dly_3");
      exp_dly = this._localReg(data_width, "even_data_dly");
      exp_dly_2 = this._localReg(data_width, "even_data_dly_2");
      exp_dly_3 = this._localReg(data_width, "even_data_dly_3");
      res = {
        out_add: this._localWire(data_width, "out_add"),
        out_sub: this._localWire(data_width, "out_sub")
      };
      this._assign(even_addr_data_dly, '508')(() => {
        return this._if(chdl_base.Expr.start().next(en[0]), '509')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data), '510');
        })._else('511')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data_dly), '512');
        })._endif();
      });
      this._assign(even_addr_data_dly_2, '514')(() => {
        return this._if(chdl_base.Expr.start().next(en[1]), '515')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data_dly), '516');
        })._else('517')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data_dly_2), '518');
        })._endif();
      });
      this._assign(even_addr_data_dly_3, '520')(() => {
        return this._if(chdl_base.Expr.start().next(en[2]), '521')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data_dly_2), '522');
        })._else('523')(() => {
          return _expr(chdl_base.Expr.start().next(even_addr_data_dly_3), '524');
        })._endif();
      });
      this._assign(exp_dly, '526')(() => {
        return this._if(chdl_base.Expr.start().next(en[0]), '527')(() => {
          return _expr(chdl_base.Expr.start().next(exp), '528');
        })._else('529')(() => {
          return _expr(chdl_base.Expr.start().next(exp_dly), '530');
        })._endif();
      });
      this._assign(exp_dly_2, '532')(() => {
        return this._if(chdl_base.Expr.start().next(en[1]), '533')(() => {
          return _expr(chdl_base.Expr.start().next(exp_dly), '534');
        })._else('535')(() => {
          return _expr(chdl_base.Expr.start().next(exp_dly_2), '536');
        })._endif();
      });
      this._assign(exp_dly_3, '538')(() => {
        return this._if(chdl_base.Expr.start().next(en[2]), '539')(() => {
          return _expr(chdl_base.Expr.start().next(exp_dly_2), '540');
        })._else('541')(() => {
          return _expr(chdl_base.Expr.start().next(exp_dly_3), '542');
        })._endif();
      });
      t = this._localWire(data_width, "t");
      this._assign(t, '544')(() => {
        return _expr(chdl_base.Expr.start().next(even_addr_data_dly_3), '544'); // complex mul need two cycle, so dly 3 cylce
      });
      e = this._localWire(data_width, "e");
      this._assign(e, '545')(() => {
        return _expr(chdl_base.Expr.start().next(complex_mul.call(this, exp_dly_3, odd_addr_data, en[0], en[1], en[2], config)), '545'); // three cycle
      });
      neg_e = this._localWire(data_width, "neg_e");
      this._assign(neg_e, '548')(() => {
        return _expr(chdl_base.Expr.start().next(cat(bin(1, 1), e.fromLsb(data_width - 1))), '548');
      });
      this._assign(res.out_add, '550')(() => {
        return _expr(chdl_base.Expr.start().next(complex_add.call(this, t, e, en[3], en[4], config)), '550'); // two cycle
      });
      this._assign(res.out_sub, '551')(() => {
        return _expr(chdl_base.Expr.start().next(complex_add.call(this, t, neg_e, en[3], en[4], config)), '551');
      });
      return res;
    },
    
    //assign add_res = out_add
    //assign sub_res = out_sub

    // $fft_ctrl:()

    // config {instr_width, addr_width} 
    $instr_fetch: function(enable, sram, config, start, end) {
      var fft_run, instr_addr, ready, ret;
      console.log("fetch");
      instr_addr = this._localReg(config.addr_width, "instr_addr");
      ret = {
        ready: this._localReg(1, "instr_ready"),
        instr: this._localReg(config.instr_width, "instr_data")
      };
      ready = this._localReg(1, "instr_ready");
      fft_run = this._localReg(1, "fft_run");
      this._assign(fft_run, '575')(() => {
        return this._if(chdl_base.Expr.start().next(end), '576')(() => {
          return _expr(chdl_base.Expr.start().next(dec(0)), '577');
        })._elseif(chdl_base.Expr.start().next(start), '578')(() => {
          return _expr(chdl_base.Expr.start().next(dec(1)), '579');
        })._else('580')(() => {
          return _expr(chdl_base.Expr.start().next(fft_run), '581');
        })._endif();
      });
      this._assign(sram.valid, '583')(() => {
        return _expr(chdl_base.Expr.start().next(fft_run).next("&&").next(enable), '583');
      });
      this._assign(sram.addr, '584')(() => {
        return _expr(chdl_base.Expr.start().next(instr_addr), '584');
      });
      this._assign(sram.we_n, '586')(() => {
        return _expr(chdl_base.Expr.start().next(dec(1)), '586');
      });
      this._assign(sram.wdata, '587')(() => {
        return _expr(chdl_base.Expr.start().next(dec(0)), '587');
      });
      this._assign(instr_addr, '589')(() => {
        return this._if(chdl_base.Expr.start().next(enable).next("&&").next(sram.ready), '590')(() => {
          return _expr(chdl_base.Expr.start().next(instr_addr).next("+").next(dec(1)), '591');
        })._else('592')(() => {
          return _expr(chdl_base.Expr.start().next(instr_addr), '593');
        })._endif();
      });
      this._assign(ready, '594')(() => {
        return _expr(chdl_base.Expr.start().next(sram.ready), '594');
      });
      this._assign(ret.ready, '596')(() => {
        return _expr(chdl_base.Expr.start().next(ready), '596');
      });
      this._assign(ret.instr, '597')(() => {
        return _expr(chdl_base.Expr.start().next(sram.rdata), '597');
      });
      return ret;
    },
    
    //################################################
    // | 15 14 13 12 | 11 10 | 9 8 7 6 5 4 3 2 1 0 | #
    // |  op_code    |  cell |      immed_10       | #
    //################################################
    // config { cell_num, instr_width, op_code_bit_width, cell_bit_width, immed_bit_width} 
    $instr_decode: function(instr_signal, enable, config, end, grant) {
      var END, FFT, GET, SET, SPACE_BASE_ADDR, STEP_ADDR, addr_incr, calc_end, cell_num, ctrl, fft_calc, get_exp, i, immed, instr, instr_grant, instr_valid, j, k, len, len1, op_code, ref, ref1, set_addr, set_space_addr, set_step_addr, space_base_addr, step_addr;
      console.log("decode");
      FFT = _expr(chdl_base.Expr.start().next(hex(config.op_code_bit_width, 1)), '610');
      SET = _expr(chdl_base.Expr.start().next(hex(config.op_code_bit_width, 2)), '611');
      GET = _expr(chdl_base.Expr.start().next(hex(config.op_code_bit_width, 3)), '612');
      END = _expr(chdl_base.Expr.start().next(hex(config.op_code_bit_width, 15)), '613');
      SPACE_BASE_ADDR = _expr(chdl_base.Expr.start().next(bin(config.cell_bit_width, 0)), '615');
      STEP_ADDR = _expr(chdl_base.Expr.start().next(bin(config.cell_bit_width, 1)), '616');
      ctrl = this.createArray(config.cell_num, () => {
        return {
          valid: this._localReg(1, "decode_valid"),
          even_addr: this._localReg(this.addr_width, "decode_even_addr"),
          odd_addr: this._localReg(this.addr_width, "decode_odd_addr"),
          exp_valid: this._localReg(1, "get_exp_valid"),
          exp_addr: this._localReg(1, "get_exp_valid")
        };
      });
      space_base_addr = this._localReg(this.addr_width, "space_base_addr");
      step_addr = this._localReg(this.addr_width, "step_addr");
      instr = this._localReg(config.instr_width, "instr");
      instr_valid = this._localReg(1, "instr_valid");
      instr_grant = this._localReg(1, "decode_grant");
      console.log(config.cell_bit_width);
      op_code = this._localWire(config.op_code_bit_width, "op_code");
      this._assign(op_code, '635')(() => {
        return _expr(chdl_base.Expr.start().next(instr.fromMsb(config.op_code_bit_width)), '635');
      });
      cell_num = this._localWire(config.cell_bit_width, "cell_num");
      this._assign(cell_num, '636')(() => {
        return _expr(chdl_base.Expr.start().next(instr.fromMsb(config.op_code_bit_width + config.cell_bit_width).fromLsb(config.cell_bit_width)), '636');
      });
      immed = this._localWire(config.immed_bit_width, "immed");
      this._assign(immed, '637')(() => {
        return _expr(chdl_base.Expr.start().next(instr.fromLsb(config.immed_bit_width)), '637');
      });
      this._assign(instr, '639')(() => {
        return this._if(chdl_base.Expr.start().next(enable).next("&&").next(instr_signal.ready), '640')(() => {
          return _expr(chdl_base.Expr.start().next(instr_signal.instr), '641');
        })._else('642')(() => {
          return _expr(chdl_base.Expr.start().next(instr), '643');
        })._endif();
      });
      this._assign(instr_grant, '645')(() => {
        return _expr(chdl_base.Expr.start().next(enable), '645');
      });
      this._assign(instr_valid, '647')(() => {
        return this._if(chdl_base.Expr.start().next(enable), '648')(() => {
          return _expr(chdl_base.Expr.start().next(instr_signal.ready), '649');
        })._else('650')(() => {
          return _expr(chdl_base.Expr.start().next(instr_valid), '651');
        })._endif();
      });
      set_addr = this._localWire(1, "set_addr");
      this._assign(set_addr, '653')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(op_code).next("==").next(SET).next(")"), '653');
      });
      get_exp = this._localWire(1, "get_exp");
      this._assign(get_exp, '654')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(op_code).next("==").next(GET).next(")"), '654');
      });
      fft_calc = this._localWire(1, "fft_calc");
      this._assign(fft_calc, '655')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(op_code).next("==").next(FFT).next(")"), '655');
      });
      calc_end = this._localWire(1, "calc_end");
      this._assign(calc_end, '656')(() => {
        return _expr(chdl_base.Expr.start().next("(").next(op_code).next("==").next(END).next(")"), '656');
      });
      set_space_addr = this._localWire(1, "set_space_addr");
      this._assign(set_space_addr, '658')(() => {
        return _expr(chdl_base.Expr.start().next(set_addr).next("&&").next("(").next(cell_num).next("==").next(SPACE_BASE_ADDR).next(")"), '658');
      });
      set_step_addr = this._localWire(1, "set_step_addr");
      this._assign(set_step_addr, '659')(() => {
        return _expr(chdl_base.Expr.start().next(set_addr).next("&&").next("(").next(cell_num).next("==").next(STEP_ADDR).next(")"), '659');
      });
      this._assign(space_base_addr, '661')(() => {
        return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(enable).next("&&").next(set_addr).next("&&").next(set_space_addr), '662')(() => {
          return _expr(chdl_base.Expr.start().next(immed), '663');
        })._else('664')(() => {
          return _expr(chdl_base.Expr.start().next(space_base_addr), '665');
        })._endif();
      });
      this._assign(step_addr, '667')(() => {
        return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(enable).next("&&").next(set_addr).next("&&").next(set_step_addr), '668')(() => {
          return _expr(chdl_base.Expr.start().next(immed), '669');
        })._else('670')(() => {
          return _expr(chdl_base.Expr.start().next(step_addr), '671');
        })._endif();
      });
      ref = _.range(config.cell_num);
      for (j = 0, len = ref.length; j < len; j++) {
        i = ref[j];
        this._assign(ctrl[i].valid, '674')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(fft_calc).next("&&").next("(").next(cell_num).next(">=").next(i).next(")").next("&&").next(enable), '675')(() => {
            return _expr(chdl_base.Expr.start().next(dec(1)), '676');
          })._else('677')(() => {
            return _expr(chdl_base.Expr.start().next(dec(0)), '678');
          })._endif();
        });
      }
      ref1 = _.range(config.cell_num);
      for (k = 0, len1 = ref1.length; k < len1; k++) {
        i = ref1[k];
        addr_incr = i * config.ram_depth;
        this._assign(ctrl[i].even_addr, '682')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(fft_calc).next("&&").next("(").next(cell_num).next(">=").next(i).next(")").next("&&").next(enable), '683')(() => {
            return _expr(chdl_base.Expr.start().next(immed).next("+").next(space_base_addr).next("+").next(addr_incr), '684');
          })._else('685')(() => {
            return _expr(chdl_base.Expr.start().next(ctrl[i].even_addr), '686');
          })._endif();
        });
        this._assign(ctrl[i].odd_addr, '688')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(fft_calc).next("&&").next("(").next(cell_num).next(">=").next(i).next(")").next("&&").next(enable), '689')(() => {
            return _expr(chdl_base.Expr.start().next(immed).next("+").next(space_base_addr).next("+").next(step_addr).next("+").next(addr_incr), '690');
          })._else('691')(() => {
            return _expr(chdl_base.Expr.start().next(ctrl[i].odd_addr), '692');
          })._endif();
        });
        this._assign(end, '694')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(calc_end).next("&&").next("(").next(cell_num).next(">=").next(i).next(")"), '695')(() => {
            return _expr(chdl_base.Expr.start().next(dec(1)), '696');
          })._else('697')(() => {
            return _expr(chdl_base.Expr.start().next(dec(0)), '698');
          })._endif();
        });
        this._assign(grant, '699')(() => {
          return _expr(chdl_base.Expr.start().next(instr_grant), '699');
        });
        this._assign(ctrl[i].exp_valid, '701')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(get_exp).next("&&").next("(").next(cell_num).next(">=").next(i).next(")").next("&&").next(enable), '702')(() => {
            return _expr(chdl_base.Expr.start().next(dec(1)), '703');
          })._else('704')(() => {
            return _expr(chdl_base.Expr.start().next(dec(0)), '705');
          })._endif();
        });
        this._assign(ctrl[i].exp_addr, '707')(() => {
          return this._if(chdl_base.Expr.start().next(instr_valid).next("&&").next(get_exp).next("&&").next("(").next(cell_num).next(">=").next(i).next(")").next("&&").next(enable), '708')(() => {
            return _expr(chdl_base.Expr.start().next(immed), '709');
          })._else('710')(() => {
            return _expr(chdl_base.Expr.start().next(ctrl[i].exp_addr), '711');
          })._endif();
        });
      }
      return ctrl;
    }
  };

  return module.exports;

}).call(this);
